package com.buyouchina.bean.product;


import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.compass.annotations.Index;
import org.compass.annotations.Searchable;
import org.compass.annotations.SearchableProperty;
import org.compass.annotations.Store;



@Entity
@Table(name="product_category") @Searchable(root=false)
public class Category {

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO) @SearchableProperty(index=Index.NO, store=Store.YES)
	private Integer id;
	//	类别名称
	@SearchableProperty(index=Index.NO, store=Store.YES)
	private String name; 
	
	//	备注
	@SearchableProperty(index=Index.NO, store=Store.YES)
	private String remark; 
	
	//	货物
	@OneToMany(mappedBy="category", cascade = CascadeType.REFRESH)
	private Set<Product> products=new HashSet<Product>();
	
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Set<Product> getProducts() {
		return products;
	}

	public void setProducts(Set<Product> products) {
		this.products = products;
	}

}
